<template>
	<view class="c-row-box">
		<view class="c-row-head"><view class="c-row-title">增项列表</view></view>
		<view class="panel-body">
			<view class="other-list">
				<view class="row">
					<view class="col"><view class="col-item-text">类型</view></view>
					<view class="col"><view>划分</view></view>
					<view class="col"><view>数量</view></view>
					<view class="col"><view>价格</view></view>
					<view class="col"><view>小计</view></view>
					<view class="col"><view>操作</view></view>
				</view>
				<view class="row" v-for="(item, index) in addons" :key="index">
					<view class="col">
						<view class="col-item-text">{{ item.other_value ? item.other_value : item.tag_title }}</view>
					</view>
					<view class="col">
						<view>{{ item.cost_master == 2 ? '公司' : item.cost_master == 3 ? '酒店' : '无' }}</view>
					</view>
					<view class="col">
						<view>{{ item.amount }}</view>
					</view>
					<view class="col">
						<view>{{ item.price }}</view>
					</view>
					<view class="col">
						<view>{{ item.total }}</view>
					</view>
					<view class="col">
						<text class="action-text primary" @click="editOtherList(item)">查看</text>
						<text class="action-text remove" @click="deleteOtherItem(index)">删除</text>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
export default {
	props: {
		parent: {},
		addons: {
			type: Array,
			default: []
		}
	},
	methods: {
		// 查看信息
		editOtherList(item) {
			this.isEdit = true;
			this.parent.showAppendOtherItemDialog(true, item);
		},
		// 删除已添加的其他费用
		deleteOtherItem(index) {
			let that = this;
			let parent = this.parent;
			uni.showModal({
				title: '提示',
				content: '确定删除该项？',
				success(res) {
					if (res.confirm) {
						// that.addType.unshift(that.addons[index]);
						that.addons.splice(index, 1);
						parent.getOtherPrice(that.addons);
					}
				}
			});
		},
	
	}
}
</script>

<style lang="less">
@import url('../../components/common.less');
@import url('../common/common.less');
</style>

